//
// Created by DengLibin on 2019/1/3 0003.
//
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include "../header/utf2gbk.h"

void print_msg_fun(char *ptr);


void thread_demo(void)
{
    pthread_t thread1;
    pthread_t thread2;
    char *s1 = "msg1";
    char *s2 = "msg2";
    int ret_1, ret_2;
    ret_1 = pthread_create(&thread1, NULL, (void *(*)(void *))print_msg_fun, s1);
    ret_2 = pthread_create(&thread2, NULL, (void *(*)(void *))print_msg_fun, s2);
    if (ret_1 != 0)
    {
        print_utf8_2_gbk("创建线程1失败\n");
    }
    else
    {
        print_utf8_2_gbk("创建线程1成功\n");
    }
    if (ret_2 != 0)
    {
        print_utf8_2_gbk("创建线程2失败\n");
    }
    else
    {
        print_utf8_2_gbk("创建线程2成功\n");
    }
    pthread_join(thread1, NULL); //等待线程1执行完
    pthread_join(thread2, NULL); //等待线程2执行完
}

int main12()
{
    // thread_demo();
    return 0;
}

void print_msg_fun(char *ptr)
{
    printf("%s\n", ptr);
}
